<template>
<div class='authList'>
     <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
  <el-table
    :data="authList"
    border
    style="width: 100%">
     <el-table-column
     label="#"
      type="index"
      width="50">
    </el-table-column>
    <el-table-column
      prop="authName"
      label="权限名称"
      width="180">
    </el-table-column>
    <el-table-column
      prop="path"
      label="路径"
      width="180">
    </el-table-column>
    <el-table-column
      prop="level"
      label="权限等级">
       <template slot-scope="scope">
          
        <el-tag v-if="scope.row.level=='0'" type="primary">一级</el-tag>
        <el-tag v-else-if="scope.row.level=='1'" type="success">二级</el-tag>
        <el-tag v-else type="warning">三级</el-tag>
      </template>
    </el-table-column>
  </el-table>
    </el-card>
</div>
</template>
<script>
export default {
components: {},
data() {
return {
    authList:[],
 };
  },
methods:{
       async getAuthList(){
            const {data:res}=await this.$http.get('rights/list')
            if(res.meta.status === 200){
                this.authList=res.data;
             
            }else{
                this.$message.error('获取列表失败')
            }
             
        },
  },
created(){
    this.getAuthList();
  },
}
</script>
<style lang='scss' scoped>
.el-card {
    margin-top: 20px;
    ::v-deep.cell{
        display:flex;
        justify-content: center;
    }
}
</style>